
/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AlertsInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[AlertsInsert]
GO

CREATE PROCEDURE [dbo].[AlertsInsert]
(
	@AlertID int,
	@TenantID int,
	@AlertMessage nvarchar(max)
)

AS

SET NOCOUNT ON

INSERT INTO [Alerts]
(
	[AlertID],
	[TenantID],
	[AlertMessage]
)
VALUES
(
	@AlertID,
	@TenantID,
	@AlertMessage
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AlertsUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[AlertsUpdate]
GO

CREATE PROCEDURE [dbo].[AlertsUpdate]
(
	@AlertID int,
	@TenantID int,
	@AlertMessage nvarchar(max)
)

AS

SET NOCOUNT ON

UPDATE [Alerts]
SET [TenantID] = @TenantID,
	[AlertMessage] = @AlertMessage
WHERE [AlertID] = @AlertID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AlertsDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[AlertsDelete]
GO

CREATE PROCEDURE [dbo].[AlertsDelete]
(
	@AlertID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [Alerts]
WHERE [AlertID] = @AlertID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AlertsSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[AlertsSelect]
GO

CREATE PROCEDURE [dbo].[AlertsSelect]
(
	@AlertID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [AlertID],
	[TenantID],
	[AlertMessage]
FROM [Alerts]
WHERE [AlertID] = @AlertID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AlertsSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[AlertsSelectAll]
GO

CREATE PROCEDURE [dbo].[AlertsSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [AlertID],
	[TenantID],
	[AlertMessage]
FROM [Alerts]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[BlockedUserInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[BlockedUserInsert]
GO

CREATE PROCEDURE [dbo].[BlockedUserInsert]
(
	@ProfileID int,
	@TenantID int,
	@BlockedProfileID int
)

AS

SET NOCOUNT ON

INSERT INTO [BlockedUser]
(
	[ProfileID],
	[TenantID],
	[BlockedProfileID]
)
VALUES
(
	@ProfileID,
	@TenantID,
	@BlockedProfileID
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EntityInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[EntityInsert]
GO

CREATE PROCEDURE [dbo].[EntityInsert]
(
	@EntityID int,
	@TenantID int,
	@EntityName nvarchar(150)
)

AS

SET NOCOUNT ON

INSERT INTO [Entity]
(
	[EntityID],
	[TenantID],
	[EntityName]
)
VALUES
(
	@EntityID,
	@TenantID,
	@EntityName
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EntityUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[EntityUpdate]
GO

CREATE PROCEDURE [dbo].[EntityUpdate]
(
	@EntityID int,
	@TenantID int,
	@EntityName nvarchar(150)
)

AS

SET NOCOUNT ON

UPDATE [Entity]
SET [TenantID] = @TenantID,
	[EntityName] = @EntityName
WHERE [EntityID] = @EntityID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EntityDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[EntityDelete]
GO

CREATE PROCEDURE [dbo].[EntityDelete]
(
	@EntityID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [Entity]
WHERE [EntityID] = @EntityID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EntitySelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[EntitySelect]
GO

CREATE PROCEDURE [dbo].[EntitySelect]
(
	@EntityID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [EntityID],
	[TenantID],
	[EntityName]
FROM [Entity]
WHERE [EntityID] = @EntityID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EntitySelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[EntitySelectAll]
GO

CREATE PROCEDURE [dbo].[EntitySelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [EntityID],
	[TenantID],
	[EntityName]
FROM [Entity]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EntityValueInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[EntityValueInsert]
GO

CREATE PROCEDURE [dbo].[EntityValueInsert]
(
	@EntityValueID int,
	@TenantID int,
	@EntityVal nvarchar(150),
	@EntityID int
)

AS

SET NOCOUNT ON

INSERT INTO [EntityValue]
(
	[EntityValueID],
	[TenantID],
	[EntityVal],
	[EntityID]
)
VALUES
(
	@EntityValueID,
	@TenantID,
	@EntityVal,
	@EntityID
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EntityValueDeleteAllByEntityID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[EntityValueDeleteAllByEntityID]
GO

CREATE PROCEDURE [dbo].[EntityValueDeleteAllByEntityID]
(
	@EntityID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [EntityValue]
WHERE [EntityID] = @EntityID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EntityValueSelectAllByEntityID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[EntityValueSelectAllByEntityID]
GO

CREATE PROCEDURE [dbo].[EntityValueSelectAllByEntityID]
(
	@EntityID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [EntityValueID],
	[TenantID],
	[EntityVal],
	[EntityID]
FROM [EntityValue]
WHERE [EntityID] = @EntityID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GeneralBuildPreferenceInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[GeneralBuildPreferenceInsert]
GO

CREATE PROCEDURE [dbo].[GeneralBuildPreferenceInsert]
(
	@GeneralBuildID int,
	@TenantID int,
	@ProfileID int,
	@PreferenceID int
)

AS

SET NOCOUNT ON

INSERT INTO [GeneralBuildPreference]
(
	[GeneralBuildID],
	[TenantID],
	[ProfileID],
	[PreferenceID]
)
VALUES
(
	@GeneralBuildID,
	@TenantID,
	@ProfileID,
	@PreferenceID
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GeneralBuildPreferenceUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[GeneralBuildPreferenceUpdate]
GO

CREATE PROCEDURE [dbo].[GeneralBuildPreferenceUpdate]
(
	@GeneralBuildID int,
	@TenantID int,
	@ProfileID int,
	@PreferenceID int
)

AS

SET NOCOUNT ON

UPDATE [GeneralBuildPreference]
SET [TenantID] = @TenantID,
	[ProfileID] = @ProfileID,
	[PreferenceID] = @PreferenceID
WHERE [GeneralBuildID] = @GeneralBuildID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GeneralBuildPreferenceDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[GeneralBuildPreferenceDelete]
GO

CREATE PROCEDURE [dbo].[GeneralBuildPreferenceDelete]
(
	@GeneralBuildID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [GeneralBuildPreference]
WHERE [GeneralBuildID] = @GeneralBuildID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GeneralBuildPreferenceDeleteAllByPreferenceID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[GeneralBuildPreferenceDeleteAllByPreferenceID]
GO

CREATE PROCEDURE [dbo].[GeneralBuildPreferenceDeleteAllByPreferenceID]
(
	@PreferenceID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [GeneralBuildPreference]
WHERE [PreferenceID] = @PreferenceID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GeneralBuildPreferenceDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[GeneralBuildPreferenceDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[GeneralBuildPreferenceDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [GeneralBuildPreference]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GeneralBuildPreferenceSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[GeneralBuildPreferenceSelect]
GO

CREATE PROCEDURE [dbo].[GeneralBuildPreferenceSelect]
(
	@GeneralBuildID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [GeneralBuildID],
	[TenantID],
	[ProfileID],
	[PreferenceID]
FROM [GeneralBuildPreference]
WHERE [GeneralBuildID] = @GeneralBuildID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GeneralBuildPreferenceSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[GeneralBuildPreferenceSelectAll]
GO

CREATE PROCEDURE [dbo].[GeneralBuildPreferenceSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [GeneralBuildID],
	[TenantID],
	[ProfileID],
	[PreferenceID]
FROM [GeneralBuildPreference]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GeneralBuildPreferenceSelectAllByPreferenceID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[GeneralBuildPreferenceSelectAllByPreferenceID]
GO

CREATE PROCEDURE [dbo].[GeneralBuildPreferenceSelectAllByPreferenceID]
(
	@PreferenceID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [GeneralBuildID],
	[TenantID],
	[ProfileID],
	[PreferenceID]
FROM [GeneralBuildPreference]
WHERE [PreferenceID] = @PreferenceID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GeneralBuildPreferenceSelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[GeneralBuildPreferenceSelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[GeneralBuildPreferenceSelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [GeneralBuildID],
	[TenantID],
	[ProfileID],
	[PreferenceID]
FROM [GeneralBuildPreference]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MaritalStatusPreferenceInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MaritalStatusPreferenceInsert]
GO

CREATE PROCEDURE [dbo].[MaritalStatusPreferenceInsert]
(
	@PreferenceID int,
	@TenantID int,
	@ProfileID int,
	@MartialStatusID int
)

AS

SET NOCOUNT ON

INSERT INTO [MaritalStatusPreference]
(
	[PreferenceID],
	[TenantID],
	[ProfileID],
	[MartialStatusID]
)
VALUES
(
	@PreferenceID,
	@TenantID,
	@ProfileID,
	@MartialStatusID
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MaritalStatusPreferenceDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MaritalStatusPreferenceDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MaritalStatusPreferenceDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MaritalStatusPreference]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MaritalStatusPreferenceSelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MaritalStatusPreferenceSelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MaritalStatusPreferenceSelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [PreferenceID],
	[TenantID],
	[ProfileID],
	[MartialStatusID]
FROM [MaritalStatusPreference]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAlertPreferenceInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAlertPreferenceInsert]
GO

CREATE PROCEDURE [dbo].[MemberAlertPreferenceInsert]
(
	@AlertPreferenceID int,
	@TenantID int,
	@ProfileID int,
	@AlertID int,
	@IsEnabled bit
)

AS

SET NOCOUNT ON

INSERT INTO [MemberAlertPreference]
(
	[AlertPreferenceID],
	[TenantID],
	[ProfileID],
	[AlertID],
	[IsEnabled]
)
VALUES
(
	@AlertPreferenceID,
	@TenantID,
	@ProfileID,
	@AlertID,
	@IsEnabled
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAlertPreferenceUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAlertPreferenceUpdate]
GO

CREATE PROCEDURE [dbo].[MemberAlertPreferenceUpdate]
(
	@AlertPreferenceID int,
	@TenantID int,
	@ProfileID int,
	@AlertID int,
	@IsEnabled bit
)

AS

SET NOCOUNT ON

UPDATE [MemberAlertPreference]
SET [TenantID] = @TenantID,
	[ProfileID] = @ProfileID,
	[AlertID] = @AlertID,
	[IsEnabled] = @IsEnabled
WHERE [AlertPreferenceID] = @AlertPreferenceID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAlertPreferenceDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAlertPreferenceDelete]
GO

CREATE PROCEDURE [dbo].[MemberAlertPreferenceDelete]
(
	@AlertPreferenceID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberAlertPreference]
WHERE [AlertPreferenceID] = @AlertPreferenceID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAlertPreferenceDeleteAllByAlertID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAlertPreferenceDeleteAllByAlertID]
GO

CREATE PROCEDURE [dbo].[MemberAlertPreferenceDeleteAllByAlertID]
(
	@AlertID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberAlertPreference]
WHERE [AlertID] = @AlertID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAlertPreferenceDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAlertPreferenceDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberAlertPreferenceDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberAlertPreference]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAlertPreferenceSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAlertPreferenceSelect]
GO

CREATE PROCEDURE [dbo].[MemberAlertPreferenceSelect]
(
	@AlertPreferenceID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [AlertPreferenceID],
	[TenantID],
	[ProfileID],
	[AlertID],
	[IsEnabled]
FROM [MemberAlertPreference]
WHERE [AlertPreferenceID] = @AlertPreferenceID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAlertPreferenceSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAlertPreferenceSelectAll]
GO

CREATE PROCEDURE [dbo].[MemberAlertPreferenceSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [AlertPreferenceID],
	[TenantID],
	[ProfileID],
	[AlertID],
	[IsEnabled]
FROM [MemberAlertPreference]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAlertPreferenceSelectAllByAlertID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAlertPreferenceSelectAllByAlertID]
GO

CREATE PROCEDURE [dbo].[MemberAlertPreferenceSelectAllByAlertID]
(
	@AlertID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [AlertPreferenceID],
	[TenantID],
	[ProfileID],
	[AlertID],
	[IsEnabled]
FROM [MemberAlertPreference]
WHERE [AlertID] = @AlertID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAlertPreferenceSelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAlertPreferenceSelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberAlertPreferenceSelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [AlertPreferenceID],
	[TenantID],
	[ProfileID],
	[AlertID],
	[IsEnabled]
FROM [MemberAlertPreference]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAudioInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAudioInsert]
GO

CREATE PROCEDURE [dbo].[MemberAudioInsert]
(
	@AudioID int,
	@TenantID int,
	@ProfileID int,
	@Title nvarchar(50),
	@SourceFile nvarchar(50),
	@AudioURL nvarchar(50),
	@IsApproved nchar(10),
	@Language nvarchar(50),
	@AddedOn datetime
)

AS

SET NOCOUNT ON

INSERT INTO [MemberAudio]
(
	[AudioID],
	[TenantID],
	[ProfileID],
	[Title],
	[SourceFile],
	[AudioURL],
	[IsApproved],
	[Language],
	[AddedOn]
)
VALUES
(
	@AudioID,
	@TenantID,
	@ProfileID,
	@Title,
	@SourceFile,
	@AudioURL,
	@IsApproved,
	@Language,
	@AddedOn
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAudioUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAudioUpdate]
GO

CREATE PROCEDURE [dbo].[MemberAudioUpdate]
(
	@AudioID int,
	@TenantID int,
	@ProfileID int,
	@Title nvarchar(50),
	@SourceFile nvarchar(50),
	@AudioURL nvarchar(50),
	@IsApproved nchar(10),
	@Language nvarchar(50),
	@AddedOn datetime
)

AS

SET NOCOUNT ON

UPDATE [MemberAudio]
SET [TenantID] = @TenantID,
	[ProfileID] = @ProfileID,
	[Title] = @Title,
	[SourceFile] = @SourceFile,
	[AudioURL] = @AudioURL,
	[IsApproved] = @IsApproved,
	[Language] = @Language,
	[AddedOn] = @AddedOn
WHERE [AudioID] = @AudioID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAudioDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAudioDelete]
GO

CREATE PROCEDURE [dbo].[MemberAudioDelete]
(
	@AudioID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberAudio]
WHERE [AudioID] = @AudioID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAudioDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAudioDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberAudioDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberAudio]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAudioSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAudioSelect]
GO

CREATE PROCEDURE [dbo].[MemberAudioSelect]
(
	@AudioID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [AudioID],
	[TenantID],
	[ProfileID],
	[Title],
	[SourceFile],
	[AudioURL],
	[IsApproved],
	[Language],
	[AddedOn]
FROM [MemberAudio]
WHERE [AudioID] = @AudioID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAudioSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAudioSelectAll]
GO

CREATE PROCEDURE [dbo].[MemberAudioSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [AudioID],
	[TenantID],
	[ProfileID],
	[Title],
	[SourceFile],
	[AudioURL],
	[IsApproved],
	[Language],
	[AddedOn]
FROM [MemberAudio]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberAudioSelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberAudioSelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberAudioSelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [AudioID],
	[TenantID],
	[ProfileID],
	[Title],
	[SourceFile],
	[AudioURL],
	[IsApproved],
	[Language],
	[AddedOn]
FROM [MemberAudio]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberGreetingInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberGreetingInsert]
GO

CREATE PROCEDURE [dbo].[MemberGreetingInsert]
(
	@MemberGreetingID int,
	@TenantID int,
	@ProfileID int,
	@AboutMe nvarchar(max),
	@ParnerPreference nvarchar(max),
	@AdditionalInfo nvarchar(max)
)

AS

SET NOCOUNT ON

INSERT INTO [MemberGreeting]
(
	[MemberGreetingID],
	[TenantID],
	[ProfileID],
	[AboutMe],
	[ParnerPreference],
	[AdditionalInfo]
)
VALUES
(
	@MemberGreetingID,
	@TenantID,
	@ProfileID,
	@AboutMe,
	@ParnerPreference,
	@AdditionalInfo
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberGreetingUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberGreetingUpdate]
GO

CREATE PROCEDURE [dbo].[MemberGreetingUpdate]
(
	@MemberGreetingID int,
	@TenantID int,
	@ProfileID int,
	@AboutMe nvarchar(max),
	@ParnerPreference nvarchar(max),
	@AdditionalInfo nvarchar(max)
)

AS

SET NOCOUNT ON

UPDATE [MemberGreeting]
SET [TenantID] = @TenantID,
	[ProfileID] = @ProfileID,
	[AboutMe] = @AboutMe,
	[ParnerPreference] = @ParnerPreference,
	[AdditionalInfo] = @AdditionalInfo
WHERE [MemberGreetingID] = @MemberGreetingID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberGreetingDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberGreetingDelete]
GO

CREATE PROCEDURE [dbo].[MemberGreetingDelete]
(
	@MemberGreetingID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberGreeting]
WHERE [MemberGreetingID] = @MemberGreetingID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberGreetingDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberGreetingDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberGreetingDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberGreeting]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberGreetingSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberGreetingSelect]
GO

CREATE PROCEDURE [dbo].[MemberGreetingSelect]
(
	@MemberGreetingID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MemberGreetingID],
	[TenantID],
	[ProfileID],
	[AboutMe],
	[ParnerPreference],
	[AdditionalInfo]
FROM [MemberGreeting]
WHERE [MemberGreetingID] = @MemberGreetingID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberGreetingSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberGreetingSelectAll]
GO

CREATE PROCEDURE [dbo].[MemberGreetingSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MemberGreetingID],
	[TenantID],
	[ProfileID],
	[AboutMe],
	[ParnerPreference],
	[AdditionalInfo]
FROM [MemberGreeting]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberGreetingSelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberGreetingSelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberGreetingSelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MemberGreetingID],
	[TenantID],
	[ProfileID],
	[AboutMe],
	[ParnerPreference],
	[AdditionalInfo]
FROM [MemberGreeting]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberIdeaMessageInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberIdeaMessageInsert]
GO

CREATE PROCEDURE [dbo].[MemberIdeaMessageInsert]
(
	@ProfileID int,
	@TenantID int,
	@IdeaID int
)

AS

SET NOCOUNT ON

INSERT INTO [MemberIdeaMessage]
(
	[ProfileID],
	[TenantID],
	[IdeaID]
)
VALUES
(
	@ProfileID,
	@TenantID,
	@IdeaID
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberIdeaMessageDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberIdeaMessageDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberIdeaMessageDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberIdeaMessage]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberIdeaMessageSelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberIdeaMessageSelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberIdeaMessageSelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [ProfileID],
	[TenantID],
	[IdeaID]
FROM [MemberIdeaMessage]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPersonalityInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPersonalityInsert]
GO

CREATE PROCEDURE [dbo].[MemberPersonalityInsert]
(
	@ProfileID int,
	@TenantID int,
	@MappingID int
)

AS

SET NOCOUNT ON

INSERT INTO [MemberPersonality]
(
	[ProfileID],
	[TenantID],
	[MappingID]
)
VALUES
(
	@ProfileID,
	@TenantID,
	@MappingID
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPersonalityDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPersonalityDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberPersonalityDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberPersonality]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPersonalitySelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPersonalitySelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberPersonalitySelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [ProfileID],
	[TenantID],
	[MappingID]
FROM [MemberPersonality]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPhotoInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPhotoInsert]
GO

CREATE PROCEDURE [dbo].[MemberPhotoInsert]
(
	@PhotoID int,
	@TenantID int,
	@ProfileID int,
	@Title nvarchar(50),
	@IsPrimary nchar(10),
	@PhotoURL nvarchar(50),
	@IsApproved nchar(10),
	@AddedOn datetime
)

AS

SET NOCOUNT ON

INSERT INTO [MemberPhoto]
(
	[PhotoID],
	[TenantID],
	[ProfileID],
	[Title],
	[IsPrimary],
	[PhotoURL],
	[IsApproved],
	[AddedOn]
)
VALUES
(
	@PhotoID,
	@TenantID,
	@ProfileID,
	@Title,
	@IsPrimary,
	@PhotoURL,
	@IsApproved,
	@AddedOn
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPhotoUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPhotoUpdate]
GO

CREATE PROCEDURE [dbo].[MemberPhotoUpdate]
(
	@PhotoID int,
	@TenantID int,
	@ProfileID int,
	@Title nvarchar(50),
	@IsPrimary nchar(10),
	@PhotoURL nvarchar(50),
	@IsApproved nchar(10),
	@AddedOn datetime
)

AS

SET NOCOUNT ON

UPDATE [MemberPhoto]
SET [TenantID] = @TenantID,
	[ProfileID] = @ProfileID,
	[Title] = @Title,
	[IsPrimary] = @IsPrimary,
	[PhotoURL] = @PhotoURL,
	[IsApproved] = @IsApproved,
	[AddedOn] = @AddedOn
WHERE [PhotoID] = @PhotoID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPhotoDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPhotoDelete]
GO

CREATE PROCEDURE [dbo].[MemberPhotoDelete]
(
	@PhotoID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberPhoto]
WHERE [PhotoID] = @PhotoID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPhotoDeleteAllByPhotoID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPhotoDeleteAllByPhotoID]
GO

CREATE PROCEDURE [dbo].[MemberPhotoDeleteAllByPhotoID]
(
	@PhotoID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberPhoto]
WHERE [PhotoID] = @PhotoID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPhotoSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPhotoSelect]
GO

CREATE PROCEDURE [dbo].[MemberPhotoSelect]
(
	@PhotoID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [PhotoID],
	[TenantID],
	[ProfileID],
	[Title],
	[IsPrimary],
	[PhotoURL],
	[IsApproved],
	[AddedOn]
FROM [MemberPhoto]
WHERE [PhotoID] = @PhotoID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPhotoSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPhotoSelectAll]
GO

CREATE PROCEDURE [dbo].[MemberPhotoSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [PhotoID],
	[TenantID],
	[ProfileID],
	[Title],
	[IsPrimary],
	[PhotoURL],
	[IsApproved],
	[AddedOn]
FROM [MemberPhoto]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPhotoSelectAllByPhotoID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPhotoSelectAllByPhotoID]
GO

CREATE PROCEDURE [dbo].[MemberPhotoSelectAllByPhotoID]
(
	@PhotoID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [PhotoID],
	[TenantID],
	[ProfileID],
	[Title],
	[IsPrimary],
	[PhotoURL],
	[IsApproved],
	[AddedOn]
FROM [MemberPhoto]
WHERE [PhotoID] = @PhotoID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPreferenceInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPreferenceInsert]
GO

CREATE PROCEDURE [dbo].[MemberPreferenceInsert]
(
	@PreferenceID int,
	@TenantID int,
	@ProfileID int,
	@Gender nchar(10),
	@FromAge nchar(10),
	@ToAge nchar(10),
	@OptOutAge nchar(10),
	@ShowOnlineStatus nchar(10),
	@ShowZodiac nchar(10),
	@FromHeight nchar(10),
	@ToHeight nchar(10),
	@Location nvarchar(50),
	@Zodiac nvarchar(50)
)

AS

SET NOCOUNT ON

INSERT INTO [MemberPreference]
(
	[PreferenceID],
	[TenantID],
	[ProfileID],
	[Gender],
	[FromAge],
	[ToAge],
	[OptOutAge],
	[ShowOnlineStatus],
	[ShowZodiac],
	[FromHeight],
	[ToHeight],
	[Location],
	[Zodiac]
)
VALUES
(
	@PreferenceID,
	@TenantID,
	@ProfileID,
	@Gender,
	@FromAge,
	@ToAge,
	@OptOutAge,
	@ShowOnlineStatus,
	@ShowZodiac,
	@FromHeight,
	@ToHeight,
	@Location,
	@Zodiac
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPreferenceUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPreferenceUpdate]
GO

CREATE PROCEDURE [dbo].[MemberPreferenceUpdate]
(
	@PreferenceID int,
	@TenantID int,
	@ProfileID int,
	@Gender nchar(10),
	@FromAge nchar(10),
	@ToAge nchar(10),
	@OptOutAge nchar(10),
	@ShowOnlineStatus nchar(10),
	@ShowZodiac nchar(10),
	@FromHeight nchar(10),
	@ToHeight nchar(10),
	@Location nvarchar(50),
	@Zodiac nvarchar(50)
)

AS

SET NOCOUNT ON

UPDATE [MemberPreference]
SET [TenantID] = @TenantID,
	[ProfileID] = @ProfileID,
	[Gender] = @Gender,
	[FromAge] = @FromAge,
	[ToAge] = @ToAge,
	[OptOutAge] = @OptOutAge,
	[ShowOnlineStatus] = @ShowOnlineStatus,
	[ShowZodiac] = @ShowZodiac,
	[FromHeight] = @FromHeight,
	[ToHeight] = @ToHeight,
	[Location] = @Location,
	[Zodiac] = @Zodiac
WHERE [PreferenceID] = @PreferenceID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPreferenceDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPreferenceDelete]
GO

CREATE PROCEDURE [dbo].[MemberPreferenceDelete]
(
	@PreferenceID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberPreference]
WHERE [PreferenceID] = @PreferenceID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPreferenceDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPreferenceDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberPreferenceDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberPreference]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPreferenceSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPreferenceSelect]
GO

CREATE PROCEDURE [dbo].[MemberPreferenceSelect]
(
	@PreferenceID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [PreferenceID],
	[TenantID],
	[ProfileID],
	[Gender],
	[FromAge],
	[ToAge],
	[OptOutAge],
	[ShowOnlineStatus],
	[ShowZodiac],
	[FromHeight],
	[ToHeight],
	[Location],
	[Zodiac]
FROM [MemberPreference]
WHERE [PreferenceID] = @PreferenceID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPreferenceSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPreferenceSelectAll]
GO

CREATE PROCEDURE [dbo].[MemberPreferenceSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [PreferenceID],
	[TenantID],
	[ProfileID],
	[Gender],
	[FromAge],
	[ToAge],
	[OptOutAge],
	[ShowOnlineStatus],
	[ShowZodiac],
	[FromHeight],
	[ToHeight],
	[Location],
	[Zodiac]
FROM [MemberPreference]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberPreferenceSelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberPreferenceSelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberPreferenceSelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [PreferenceID],
	[TenantID],
	[ProfileID],
	[Gender],
	[FromAge],
	[ToAge],
	[OptOutAge],
	[ShowOnlineStatus],
	[ShowZodiac],
	[FromHeight],
	[ToHeight],
	[Location],
	[Zodiac]
FROM [MemberPreference]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberProfileInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberProfileInsert]
GO

CREATE PROCEDURE [dbo].[MemberProfileInsert]
(
	@ProfileID int,
	@TenantID int,
	@UserName nvarchar(50),
	@Passwrd nvarchar(50),
	@EmailId nvarchar(50),
	@DOB datetime,
	@Height nvarchar(50),
	@GeneralBuild nvarchar(50),
	@HairColor nvarchar(50),
	@EyeColor nvarchar(50),
	@Ethnicity nvarchar(50),
	@SmokingPreference nvarchar(50),
	@Looks nvarchar(50),
	@Occupation nvarchar(50),
	@Income nvarchar(50),
	@RelationshipExpectation nvarchar(max),
	@MartialStatus nchar(10),
	@NumberOfChildren nchar(10),
	@LivingAtHome nchar(10),
	@Religion nvarchar(50),
	@Pet nchar(10),
	@Country nvarchar(50),
	@State nvarchar(50),
	@City nvarchar(50),
	@Postcode nvarchar(50),
	@Wallpaper nvarchar(50),
	@Icon nvarchar(50),
	@CreatedOn datetime,
	@LastLoginOn datetime,
	@IsLoggedIn char(10)
)

AS

SET NOCOUNT ON

INSERT INTO [MemberProfile]
(
	[ProfileID],
	[TenantID],
	[UserName],
	[Passwrd],
	[EmailId],
	[DOB],
	[Height],
	[GeneralBuild],
	[HairColor],
	[EyeColor],
	[Ethnicity],
	[SmokingPreference],
	[Looks],
	[Occupation],
	[Income],
	[RelationshipExpectation],
	[MartialStatus],
	[NumberOfChildren],
	[LivingAtHome],
	[Religion],
	[Pet],
	[Country],
	[State],
	[City],
	[Postcode],
	[Wallpaper],
	[Icon],
	[CreatedOn],
	[LastLoginOn],
	[IsLoggedIn]
)
VALUES
(
	@ProfileID,
	@TenantID,
	@UserName,
	@Passwrd,
	@EmailId,
	@DOB,
	@Height,
	@GeneralBuild,
	@HairColor,
	@EyeColor,
	@Ethnicity,
	@SmokingPreference,
	@Looks,
	@Occupation,
	@Income,
	@RelationshipExpectation,
	@MartialStatus,
	@NumberOfChildren,
	@LivingAtHome,
	@Religion,
	@Pet,
	@Country,
	@State,
	@City,
	@Postcode,
	@Wallpaper,
	@Icon,
	@CreatedOn,
	@LastLoginOn,
	@IsLoggedIn
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberProfileUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberProfileUpdate]
GO

CREATE PROCEDURE [dbo].[MemberProfileUpdate]
(
	@ProfileID int,
	@TenantID int,
	@UserName nvarchar(50),
	@Passwrd nvarchar(50),
	@EmailId nvarchar(50),
	@DOB datetime,
	@Height nvarchar(50),
	@GeneralBuild nvarchar(50),
	@HairColor nvarchar(50),
	@EyeColor nvarchar(50),
	@Ethnicity nvarchar(50),
	@SmokingPreference nvarchar(50),
	@Looks nvarchar(50),
	@Occupation nvarchar(50),
	@Income nvarchar(50),
	@RelationshipExpectation nvarchar(max),
	@MartialStatus nchar(10),
	@NumberOfChildren nchar(10),
	@LivingAtHome nchar(10),
	@Religion nvarchar(50),
	@Pet nchar(10),
	@Country nvarchar(50),
	@State nvarchar(50),
	@City nvarchar(50),
	@Postcode nvarchar(50),
	@Wallpaper nvarchar(50),
	@Icon nvarchar(50),
	@CreatedOn datetime,
	@LastLoginOn datetime,
	@IsLoggedIn char(10)
)

AS

SET NOCOUNT ON

UPDATE [MemberProfile]
SET [TenantID] = @TenantID,
	[UserName] = @UserName,
	[Passwrd] = @Passwrd,
	[EmailId] = @EmailId,
	[DOB] = @DOB,
	[Height] = @Height,
	[GeneralBuild] = @GeneralBuild,
	[HairColor] = @HairColor,
	[EyeColor] = @EyeColor,
	[Ethnicity] = @Ethnicity,
	[SmokingPreference] = @SmokingPreference,
	[Looks] = @Looks,
	[Occupation] = @Occupation,
	[Income] = @Income,
	[RelationshipExpectation] = @RelationshipExpectation,
	[MartialStatus] = @MartialStatus,
	[NumberOfChildren] = @NumberOfChildren,
	[LivingAtHome] = @LivingAtHome,
	[Religion] = @Religion,
	[Pet] = @Pet,
	[Country] = @Country,
	[State] = @State,
	[City] = @City,
	[Postcode] = @Postcode,
	[Wallpaper] = @Wallpaper,
	[Icon] = @Icon,
	[CreatedOn] = @CreatedOn,
	[LastLoginOn] = @LastLoginOn,
	[IsLoggedIn] = @IsLoggedIn
WHERE [ProfileID] = @ProfileID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberProfileDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberProfileDelete]
GO

CREATE PROCEDURE [dbo].[MemberProfileDelete]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberProfile]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberProfileSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberProfileSelect]
GO

CREATE PROCEDURE [dbo].[MemberProfileSelect]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [ProfileID],
	[TenantID],
	[UserName],
	[Passwrd],
	[EmailId],
	[DOB],
	[Height],
	[GeneralBuild],
	[HairColor],
	[EyeColor],
	[Ethnicity],
	[SmokingPreference],
	[Looks],
	[Occupation],
	[Income],
	[RelationshipExpectation],
	[MartialStatus],
	[NumberOfChildren],
	[LivingAtHome],
	[Religion],
	[Pet],
	[Country],
	[State],
	[City],
	[Postcode],
	[Wallpaper],
	[Icon],
	[CreatedOn],
	[LastLoginOn],
	[IsLoggedIn]
FROM [MemberProfile]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberProfileSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberProfileSelectAll]
GO

CREATE PROCEDURE [dbo].[MemberProfileSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [ProfileID],
	[TenantID],
	[UserName],
	[Passwrd],
	[EmailId],
	[DOB],
	[Height],
	[GeneralBuild],
	[HairColor],
	[EyeColor],
	[Ethnicity],
	[SmokingPreference],
	[Looks],
	[Occupation],
	[Income],
	[RelationshipExpectation],
	[MartialStatus],
	[NumberOfChildren],
	[LivingAtHome],
	[Religion],
	[Pet],
	[Country],
	[State],
	[City],
	[Postcode],
	[Wallpaper],
	[Icon],
	[CreatedOn],
	[LastLoginOn],
	[IsLoggedIn]
FROM [MemberProfile]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberSubscriptionInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberSubscriptionInsert]
GO

CREATE PROCEDURE [dbo].[MemberSubscriptionInsert]
(
	@MemberSubscriptionID int,
	@TenantID int,
	@ProfileID int,
	@SubscriptionID int,
	@IsActive bit,
	@CraetedDate datetime,
	@UpdateDate nchar(10)
)

AS

SET NOCOUNT ON

INSERT INTO [MemberSubscription]
(
	[MemberSubscriptionID],
	[TenantID],
	[ProfileID],
	[SubscriptionID],
	[IsActive],
	[CraetedDate],
	[UpdateDate]
)
VALUES
(
	@MemberSubscriptionID,
	@TenantID,
	@ProfileID,
	@SubscriptionID,
	@IsActive,
	@CraetedDate,
	@UpdateDate
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberSubscriptionUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberSubscriptionUpdate]
GO

CREATE PROCEDURE [dbo].[MemberSubscriptionUpdate]
(
	@MemberSubscriptionID int,
	@TenantID int,
	@ProfileID int,
	@SubscriptionID int,
	@IsActive bit,
	@CraetedDate datetime,
	@UpdateDate nchar(10)
)

AS

SET NOCOUNT ON

UPDATE [MemberSubscription]
SET [TenantID] = @TenantID,
	[ProfileID] = @ProfileID,
	[SubscriptionID] = @SubscriptionID,
	[IsActive] = @IsActive,
	[CraetedDate] = @CraetedDate,
	[UpdateDate] = @UpdateDate
WHERE [MemberSubscriptionID] = @MemberSubscriptionID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberSubscriptionDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberSubscriptionDelete]
GO

CREATE PROCEDURE [dbo].[MemberSubscriptionDelete]
(
	@MemberSubscriptionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberSubscription]
WHERE [MemberSubscriptionID] = @MemberSubscriptionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberSubscriptionDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberSubscriptionDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberSubscriptionDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberSubscription]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberSubscriptionDeleteAllBySubscriptionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberSubscriptionDeleteAllBySubscriptionID]
GO

CREATE PROCEDURE [dbo].[MemberSubscriptionDeleteAllBySubscriptionID]
(
	@SubscriptionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberSubscription]
WHERE [SubscriptionID] = @SubscriptionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberSubscriptionSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberSubscriptionSelect]
GO

CREATE PROCEDURE [dbo].[MemberSubscriptionSelect]
(
	@MemberSubscriptionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MemberSubscriptionID],
	[TenantID],
	[ProfileID],
	[SubscriptionID],
	[IsActive],
	[CraetedDate],
	[UpdateDate]
FROM [MemberSubscription]
WHERE [MemberSubscriptionID] = @MemberSubscriptionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberSubscriptionSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberSubscriptionSelectAll]
GO

CREATE PROCEDURE [dbo].[MemberSubscriptionSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MemberSubscriptionID],
	[TenantID],
	[ProfileID],
	[SubscriptionID],
	[IsActive],
	[CraetedDate],
	[UpdateDate]
FROM [MemberSubscription]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberSubscriptionSelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberSubscriptionSelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberSubscriptionSelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MemberSubscriptionID],
	[TenantID],
	[ProfileID],
	[SubscriptionID],
	[IsActive],
	[CraetedDate],
	[UpdateDate]
FROM [MemberSubscription]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberSubscriptionSelectAllBySubscriptionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberSubscriptionSelectAllBySubscriptionID]
GO

CREATE PROCEDURE [dbo].[MemberSubscriptionSelectAllBySubscriptionID]
(
	@SubscriptionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MemberSubscriptionID],
	[TenantID],
	[ProfileID],
	[SubscriptionID],
	[IsActive],
	[CraetedDate],
	[UpdateDate]
FROM [MemberSubscription]
WHERE [SubscriptionID] = @SubscriptionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberVideoInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberVideoInsert]
GO

CREATE PROCEDURE [dbo].[MemberVideoInsert]
(
	@VideoID int,
	@TenantID int,
	@ProfileID int,
	@Title nvarchar(50),
	@VideoURL nvarchar(50),
	@IsApproved nchar(10),
	@AddedOn nchar(10)
)

AS

SET NOCOUNT ON

INSERT INTO [MemberVideo]
(
	[VideoID],
	[TenantID],
	[ProfileID],
	[Title],
	[VideoURL],
	[IsApproved],
	[AddedOn]
)
VALUES
(
	@VideoID,
	@TenantID,
	@ProfileID,
	@Title,
	@VideoURL,
	@IsApproved,
	@AddedOn
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberVideoUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberVideoUpdate]
GO

CREATE PROCEDURE [dbo].[MemberVideoUpdate]
(
	@VideoID int,
	@TenantID int,
	@ProfileID int,
	@Title nvarchar(50),
	@VideoURL nvarchar(50),
	@IsApproved nchar(10),
	@AddedOn nchar(10)
)

AS

SET NOCOUNT ON

UPDATE [MemberVideo]
SET [TenantID] = @TenantID,
	[ProfileID] = @ProfileID,
	[Title] = @Title,
	[VideoURL] = @VideoURL,
	[IsApproved] = @IsApproved,
	[AddedOn] = @AddedOn
WHERE [VideoID] = @VideoID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberVideoDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberVideoDelete]
GO

CREATE PROCEDURE [dbo].[MemberVideoDelete]
(
	@VideoID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberVideo]
WHERE [VideoID] = @VideoID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberVideoDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberVideoDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberVideoDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MemberVideo]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberVideoSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberVideoSelect]
GO

CREATE PROCEDURE [dbo].[MemberVideoSelect]
(
	@VideoID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [VideoID],
	[TenantID],
	[ProfileID],
	[Title],
	[VideoURL],
	[IsApproved],
	[AddedOn]
FROM [MemberVideo]
WHERE [VideoID] = @VideoID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberVideoSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberVideoSelectAll]
GO

CREATE PROCEDURE [dbo].[MemberVideoSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [VideoID],
	[TenantID],
	[ProfileID],
	[Title],
	[VideoURL],
	[IsApproved],
	[AddedOn]
FROM [MemberVideo]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MemberVideoSelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MemberVideoSelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[MemberVideoSelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [VideoID],
	[TenantID],
	[ProfileID],
	[Title],
	[VideoURL],
	[IsApproved],
	[AddedOn]
FROM [MemberVideo]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MessageIdeaInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MessageIdeaInsert]
GO

CREATE PROCEDURE [dbo].[MessageIdeaInsert]
(
	@IdeaID int,
	@TenantID int,
	@Message nvarchar(max)
)

AS

SET NOCOUNT ON

INSERT INTO [MessageIdea]
(
	[IdeaID],
	[TenantID],
	[Message]
)
VALUES
(
	@IdeaID,
	@TenantID,
	@Message
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MessageIdeaUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MessageIdeaUpdate]
GO

CREATE PROCEDURE [dbo].[MessageIdeaUpdate]
(
	@IdeaID int,
	@TenantID int,
	@Message nvarchar(max)
)

AS

SET NOCOUNT ON

UPDATE [MessageIdea]
SET [TenantID] = @TenantID,
	[Message] = @Message
WHERE [IdeaID] = @IdeaID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MessageIdeaDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MessageIdeaDelete]
GO

CREATE PROCEDURE [dbo].[MessageIdeaDelete]
(
	@IdeaID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [MessageIdea]
WHERE [IdeaID] = @IdeaID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MessageIdeaSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MessageIdeaSelect]
GO

CREATE PROCEDURE [dbo].[MessageIdeaSelect]
(
	@IdeaID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [IdeaID],
	[TenantID],
	[Message]
FROM [MessageIdea]
WHERE [IdeaID] = @IdeaID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MessageIdeaSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[MessageIdeaSelectAll]
GO

CREATE PROCEDURE [dbo].[MessageIdeaSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [IdeaID],
	[TenantID],
	[Message]
FROM [MessageIdea]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityMappingInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityMappingInsert]
GO

CREATE PROCEDURE [dbo].[PersonalityMappingInsert]
(
	@MappingID int,
	@TenantID int,
	@QuestionID int,
	@ValueID int,
	@Order int
)

AS

SET NOCOUNT ON

INSERT INTO [PersonalityMapping]
(
	[MappingID],
	[TenantID],
	[QuestionID],
	[ValueID],
	[Order]
)
VALUES
(
	@MappingID,
	@TenantID,
	@QuestionID,
	@ValueID,
	@Order
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityMappingUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityMappingUpdate]
GO

CREATE PROCEDURE [dbo].[PersonalityMappingUpdate]
(
	@MappingID int,
	@TenantID int,
	@QuestionID int,
	@ValueID int,
	@Order int
)

AS

SET NOCOUNT ON

UPDATE [PersonalityMapping]
SET [TenantID] = @TenantID,
	[QuestionID] = @QuestionID,
	[ValueID] = @ValueID,
	[Order] = @Order
WHERE [MappingID] = @MappingID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityMappingDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityMappingDelete]
GO

CREATE PROCEDURE [dbo].[PersonalityMappingDelete]
(
	@MappingID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [PersonalityMapping]
WHERE [MappingID] = @MappingID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityMappingDeleteAllByQuestionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityMappingDeleteAllByQuestionID]
GO

CREATE PROCEDURE [dbo].[PersonalityMappingDeleteAllByQuestionID]
(
	@QuestionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [PersonalityMapping]
WHERE [QuestionID] = @QuestionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityMappingSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityMappingSelect]
GO

CREATE PROCEDURE [dbo].[PersonalityMappingSelect]
(
	@MappingID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MappingID],
	[TenantID],
	[QuestionID],
	[ValueID],
	[Order]
FROM [PersonalityMapping]
WHERE [MappingID] = @MappingID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityMappingSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityMappingSelectAll]
GO

CREATE PROCEDURE [dbo].[PersonalityMappingSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MappingID],
	[TenantID],
	[QuestionID],
	[ValueID],
	[Order]
FROM [PersonalityMapping]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityMappingSelectAllByQuestionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityMappingSelectAllByQuestionID]
GO

CREATE PROCEDURE [dbo].[PersonalityMappingSelectAllByQuestionID]
(
	@QuestionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [MappingID],
	[TenantID],
	[QuestionID],
	[ValueID],
	[Order]
FROM [PersonalityMapping]
WHERE [QuestionID] = @QuestionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityQuestionInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityQuestionInsert]
GO

CREATE PROCEDURE [dbo].[PersonalityQuestionInsert]
(
	@QuestionID int,
	@TenantID int,
	@Question nvarchar(max),
	@Order int
)

AS

SET NOCOUNT ON

INSERT INTO [PersonalityQuestion]
(
	[QuestionID],
	[TenantID],
	[Question],
	[Order]
)
VALUES
(
	@QuestionID,
	@TenantID,
	@Question,
	@Order
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityQuestionUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityQuestionUpdate]
GO

CREATE PROCEDURE [dbo].[PersonalityQuestionUpdate]
(
	@QuestionID int,
	@TenantID int,
	@Question nvarchar(max),
	@Order int
)

AS

SET NOCOUNT ON

UPDATE [PersonalityQuestion]
SET [TenantID] = @TenantID,
	[Question] = @Question,
	[Order] = @Order
WHERE [QuestionID] = @QuestionID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityQuestionDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityQuestionDelete]
GO

CREATE PROCEDURE [dbo].[PersonalityQuestionDelete]
(
	@QuestionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [PersonalityQuestion]
WHERE [QuestionID] = @QuestionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityQuestionSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityQuestionSelect]
GO

CREATE PROCEDURE [dbo].[PersonalityQuestionSelect]
(
	@QuestionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [QuestionID],
	[TenantID],
	[Question],
	[Order]
FROM [PersonalityQuestion]
WHERE [QuestionID] = @QuestionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityQuestionSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityQuestionSelectAll]
GO

CREATE PROCEDURE [dbo].[PersonalityQuestionSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [QuestionID],
	[TenantID],
	[Question],
	[Order]
FROM [PersonalityQuestion]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityValueInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityValueInsert]
GO

CREATE PROCEDURE [dbo].[PersonalityValueInsert]
(
	@ValueID int,
	@TenantID int,
	@ValueText nvarchar(max)
)

AS

SET NOCOUNT ON

INSERT INTO [PersonalityValue]
(
	[ValueID],
	[TenantID],
	[ValueText]
)
VALUES
(
	@ValueID,
	@TenantID,
	@ValueText
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityValueUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityValueUpdate]
GO

CREATE PROCEDURE [dbo].[PersonalityValueUpdate]
(
	@ValueID int,
	@TenantID int,
	@ValueText nvarchar(max)
)

AS

SET NOCOUNT ON

UPDATE [PersonalityValue]
SET [TenantID] = @TenantID,
	[ValueText] = @ValueText
WHERE [ValueID] = @ValueID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityValueDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityValueDelete]
GO

CREATE PROCEDURE [dbo].[PersonalityValueDelete]
(
	@ValueID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [PersonalityValue]
WHERE [ValueID] = @ValueID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityValueSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityValueSelect]
GO

CREATE PROCEDURE [dbo].[PersonalityValueSelect]
(
	@ValueID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [ValueID],
	[TenantID],
	[ValueText]
FROM [PersonalityValue]
WHERE [ValueID] = @ValueID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PersonalityValueSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[PersonalityValueSelectAll]
GO

CREATE PROCEDURE [dbo].[PersonalityValueSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [ValueID],
	[TenantID],
	[ValueText]
FROM [PersonalityValue]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SubscriptionInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SubscriptionInsert]
GO

CREATE PROCEDURE [dbo].[SubscriptionInsert]
(
	@SubscriptionID int,
	@TenantID int,
	@Name nvarchar(50),
	@ValidityPeriod nchar(10),
	@Rate nvarchar(50),
	@Description nvarchar(max)
)

AS

SET NOCOUNT ON

INSERT INTO [Subscription]
(
	[SubscriptionID],
	[TenantID],
	[Name],
	[ValidityPeriod],
	[Rate],
	[Description]
)
VALUES
(
	@SubscriptionID,
	@TenantID,
	@Name,
	@ValidityPeriod,
	@Rate,
	@Description
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SubscriptionUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SubscriptionUpdate]
GO

CREATE PROCEDURE [dbo].[SubscriptionUpdate]
(
	@SubscriptionID int,
	@TenantID int,
	@Name nvarchar(50),
	@ValidityPeriod nchar(10),
	@Rate nvarchar(50),
	@Description nvarchar(max)
)

AS

SET NOCOUNT ON

UPDATE [Subscription]
SET [TenantID] = @TenantID,
	[Name] = @Name,
	[ValidityPeriod] = @ValidityPeriod,
	[Rate] = @Rate,
	[Description] = @Description
WHERE [SubscriptionID] = @SubscriptionID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SubscriptionDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SubscriptionDelete]
GO

CREATE PROCEDURE [dbo].[SubscriptionDelete]
(
	@SubscriptionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [Subscription]
WHERE [SubscriptionID] = @SubscriptionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SubscriptionSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SubscriptionSelect]
GO

CREATE PROCEDURE [dbo].[SubscriptionSelect]
(
	@SubscriptionID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [SubscriptionID],
	[TenantID],
	[Name],
	[ValidityPeriod],
	[Rate],
	[Description]
FROM [Subscription]
WHERE [SubscriptionID] = @SubscriptionID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SubscriptionSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SubscriptionSelectAll]
GO

CREATE PROCEDURE [dbo].[SubscriptionSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [SubscriptionID],
	[TenantID],
	[Name],
	[ValidityPeriod],
	[Rate],
	[Description]
FROM [Subscription]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SuccessStoryInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SuccessStoryInsert]
GO

CREATE PROCEDURE [dbo].[SuccessStoryInsert]
(
	@SuccessStoryID int,
	@TenantID int,
	@ProfileID int,
	@PhoneNumber nvarchar(50),
	@EmailID nvarchar(50),
	@StoryText nvarchar(max)
)

AS

SET NOCOUNT ON

INSERT INTO [SuccessStory]
(
	[SuccessStoryID],
	[TenantID],
	[ProfileID],
	[PhoneNumber],
	[EmailID],
	[StoryText]
)
VALUES
(
	@SuccessStoryID,
	@TenantID,
	@ProfileID,
	@PhoneNumber,
	@EmailID,
	@StoryText
)
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SuccessStoryUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SuccessStoryUpdate]
GO

CREATE PROCEDURE [dbo].[SuccessStoryUpdate]
(
	@SuccessStoryID int,
	@TenantID int,
	@ProfileID int,
	@PhoneNumber nvarchar(50),
	@EmailID nvarchar(50),
	@StoryText nvarchar(max)
)

AS

SET NOCOUNT ON

UPDATE [SuccessStory]
SET [TenantID] = @TenantID,
	[ProfileID] = @ProfileID,
	[PhoneNumber] = @PhoneNumber,
	[EmailID] = @EmailID,
	[StoryText] = @StoryText
WHERE [SuccessStoryID] = @SuccessStoryID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SuccessStoryDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SuccessStoryDelete]
GO

CREATE PROCEDURE [dbo].[SuccessStoryDelete]
(
	@SuccessStoryID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [SuccessStory]
WHERE [SuccessStoryID] = @SuccessStoryID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SuccessStoryDeleteAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SuccessStoryDeleteAllByProfileID]
GO

CREATE PROCEDURE [dbo].[SuccessStoryDeleteAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [SuccessStory]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SuccessStorySelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SuccessStorySelect]
GO

CREATE PROCEDURE [dbo].[SuccessStorySelect]
(
	@SuccessStoryID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [SuccessStoryID],
	[TenantID],
	[ProfileID],
	[PhoneNumber],
	[EmailID],
	[StoryText]
FROM [SuccessStory]
WHERE [SuccessStoryID] = @SuccessStoryID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SuccessStorySelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SuccessStorySelectAll]
GO

CREATE PROCEDURE [dbo].[SuccessStorySelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [SuccessStoryID],
	[TenantID],
	[ProfileID],
	[PhoneNumber],
	[EmailID],
	[StoryText]
FROM [SuccessStory]
WHERE [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SuccessStorySelectAllByProfileID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[SuccessStorySelectAllByProfileID]
GO

CREATE PROCEDURE [dbo].[SuccessStorySelectAllByProfileID]
(
	@ProfileID int
	, @TenantID int
)

AS

SET NOCOUNT ON

SELECT [SuccessStoryID],
	[TenantID],
	[ProfileID],
	[PhoneNumber],
	[EmailID],
	[StoryText]
FROM [SuccessStory]
WHERE [ProfileID] = @ProfileID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TenantInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[TenantInsert]
GO

CREATE PROCEDURE [dbo].[TenantInsert]
(
	@TenantTypeID nvarchar(255),
	@TenantDescription nvarchar(max),
	@TenantImage nvarchar(50),
	@IsActive bit,
	@TenantSecureCode nvarchar(255),
	@CreatedDate datetime,
	@SubscriptionEndDate datetime,
	@UpdateDate datetime,
	@UpdatedBy nvarchar(50)
)

AS

SET NOCOUNT ON

INSERT INTO [Tenant]
(
	[TenantTypeID],
	[TenantDescription],
	[TenantImage],
	[IsActive],
	[TenantSecureCode],
	[CreatedDate],
	[SubscriptionEndDate],
	[UpdateDate],
	[UpdatedBy]
)
VALUES
(
	@TenantTypeID,
	@TenantDescription,
	@TenantImage,
	@IsActive,
	@TenantSecureCode,
	@CreatedDate,
	@SubscriptionEndDate,
	@UpdateDate,
	@UpdatedBy
)

SELECT IDENT_CURRENT('Tenant')
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TenantUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[TenantUpdate]
GO

CREATE PROCEDURE [dbo].[TenantUpdate]
(
	@TenantID int,
	@TenantTypeID nvarchar(255),
	@TenantDescription nvarchar(max),
	@TenantImage nvarchar(50),
	@IsActive bit,
	@TenantSecureCode nvarchar(255),
	@CreatedDate datetime,
	@SubscriptionEndDate datetime,
	@UpdateDate datetime,
	@UpdatedBy nvarchar(50)
)

AS

SET NOCOUNT ON

UPDATE [Tenant]
SET [TenantTypeID] = @TenantTypeID,
	[TenantDescription] = @TenantDescription,
	[TenantImage] = @TenantImage,
	[IsActive] = @IsActive,
	[TenantSecureCode] = @TenantSecureCode,
	[CreatedDate] = @CreatedDate,
	[SubscriptionEndDate] = @SubscriptionEndDate,
	[UpdateDate] = @UpdateDate,
	[UpdatedBy] = @UpdatedBy
WHERE [TenantID] = @TenantID	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TenantDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[TenantDelete]
GO

CREATE PROCEDURE [dbo].[TenantDelete]
(
	@TenantID int
)

AS

SET NOCOUNT ON

DELETE FROM [Tenant]
WHERE [TenantID] = @TenantID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TenantSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[TenantSelect]
GO

CREATE PROCEDURE [dbo].[TenantSelect]
(
	@TenantID int
)

AS

SET NOCOUNT ON

SELECT [TenantID],
	[TenantTypeID],
	[TenantDescription],
	[TenantImage],
	[IsActive],
	[TenantSecureCode],
	[CreatedDate],
	[SubscriptionEndDate],
	[UpdateDate],
	[UpdatedBy]
FROM [Tenant]
WHERE [TenantID] = @TenantID
	AND [TenantID] = @TenantID
GO

/******************************************************************************
******************************************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TenantSelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[TenantSelectAll]
GO

CREATE PROCEDURE [dbo].[TenantSelectAll]
(
	 @TenantID int
)

AS

SET NOCOUNT ON

SELECT [TenantID],
	[TenantTypeID],
	[TenantDescription],
	[TenantImage],
	[IsActive],
	[TenantSecureCode],
	[CreatedDate],
	[SubscriptionEndDate],
	[UpdateDate],
	[UpdatedBy]
FROM [Tenant]
WHERE [TenantID] = @TenantID
GO
